#define _CRT_SECURE_NO_WARNINGS 1
#include"F.h"



void stack::Init(int n)
{
	array = (int*)malloc(sizeof(int) * n);
	if (nullptr == array)
	{
		perror("malloc");
		exit(1);
	}
	capacity = n;
	top = 0;
}



void stack::Destory()
{
	free(array);
	array == nullptr;
	capacity = top = 0;
}

int stack::Top()
{
	assert(top > 0);
	return array[top - 1];
}